/*
 * Copyright 2016 Wealth Inc. All rights reserved.
 */
 package com.wealth.order.entity;


import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.springframework.context.annotation.Lazy;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wealth.bank.entity.Picked;
import com.wealth.express.entity.Express;
import com.wealth.member.entity.Member;
import com.wealth.merchant.entity.Merchant;
import com.wealth.system.entity.Corporation;

@Entity
@Table(name = "t_order")
public class Order implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private Long id;
	private String orderno;
	private String expressno;
	private Double expressprice;

	private Integer status;
	private Integer paystatus;
	private Integer deliverstatus;
	private Integer signstatus;
	private Integer evaluatestatus;
	private Double actualPrice;
	private Double subPrice;
	private Double total;
	private Integer score;
	private Integer amount;
	private String receiver;
	private String address;
	private String telephone;
	private String remark;
	private Date createTime;
	private Date payTime;
	private Date deliverTime;
	private Date signTime;
	private Picked picked;
	private Merchant  merchant;	//商户
	private Express express;			// 快递
	private OrderPlat orderPlat;		//平台订单
	private Corporation corp; 		//银行
	private Member member;		//会员信息
	private String remarks;//备注
	private OrderVirtual orderVirtual;//生码规则
	

	private List<OrderItem> orderItemList = new ArrayList<OrderItem>();
	private List<VoucherRecord> voucherRecordList = new ArrayList<VoucherRecord>();	//代金券列表

	
	


	/* ---------------- method ----------------*/
	
	
	

	public Order(){
	}

	public Order(Long id){
		this.id = id;
	}

	/* ---------------- getter/setter ----------------*/
	
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	@OneToOne
	@JoinColumn(name="order_virtual_id")
	public OrderVirtual getOrderVirtual() {
		return orderVirtual;
	}

	public void setOrderVirtual(OrderVirtual orderVirtual) {
		this.orderVirtual = orderVirtual;
	}
	
	@Column(name = "orderno")
	public String getOrderno() {
		return orderno;
	}
	
	public void setOrderno(String orderno) {
		this.orderno = orderno;
	}
	
	@Column(name = "expressno")
	public String getExpressno() {
		return expressno;
	}
	
	public void setExpressno(String expressno) {
		this.expressno = expressno;
	}
	
	@Column(name = "status")
	public Integer getStatus() {
		return status;
	}
	
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@Column(name = "paystatus")
	public Integer getPaystatus() {
		return paystatus;
	}
	
	public void setPaystatus(Integer paystatus) {
		this.paystatus = paystatus;
	}
	
	public Integer getSignstatus() {
		return signstatus;
	}

	public void setSignstatus(Integer signstatus) {
		this.signstatus = signstatus;
	}

	@Column(name = "actual_price")
	public Double getActualPrice() {
		return actualPrice;
	}
	
	public void setActualPrice(Double actualPrice) {
		this.actualPrice = actualPrice;
	}
	
	@Column(name = "sub_price")
	public Double getSubPrice() {
		return subPrice;
	}
	
	public void setSubPrice(Double subPrice) {
		this.subPrice = subPrice;
	}
	
	@Column(name = "total")
	public Double getTotal() {
		return total;
	}
	
	public void setTotal(Double total) {
		this.total = total;
	}
	
	@Column(name = "score")
	public Integer getScore() {
		return score;
	}
	
	public void setScore(Integer score) {
		this.score = score;
	}
	
	@Column(name = "amount")
	public Integer getAmount() {
		return amount;
	}
	
	public void setAmount(Integer amount) {
		this.amount = amount;
	}
	
	@Column(name = "receiver")
	public String getReceiver() {
		return receiver;
	}
	
	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}
	
	@Column(name = "address")
	public String getAddress() {
		return address;
	}
	
	public void setAddress(String address) {
		this.address = address;
	}
	
	@Column(name = "telephone")
	public String getTelephone() {
		return telephone;
	}
	
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	
	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}
	
	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@Column(name = "create_time")
	public Date getCreateTime() {
		return createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@Column(name = "pay_time")
	public Date getPayTime() {
		return payTime;
	}
	
	public void setPayTime(Date payTime) {
		this.payTime = payTime;
	}
	
	
	@Column(name = "sign_time")
	public Date getSignTime() {
		return signTime;
	}

	public Integer getDeliverstatus() {
		return deliverstatus;
	}

	public void setDeliverstatus(Integer deliverstatus) {
		this.deliverstatus = deliverstatus;
	}
	
	public Integer getEvaluatestatus() {
		return evaluatestatus;
	}

	public void setEvaluatestatus(Integer evaluatestatus) {
		this.evaluatestatus = evaluatestatus;
	}
	
	@Column(name = "deliver_time")
	public Date getDeliverTime() {
		return deliverTime;
	}

	public void setDeliverTime(Date deliverTime) {
		this.deliverTime = deliverTime;
	}

	public void setSignTime(Date signTime) {
		this.signTime = signTime;
	}
	
	@ManyToOne
	@JoinColumn(name="member_id")
	public Member getMember() {
		return member;
	}

	public void setMember(Member member) {
		this.member = member;
	}
	
	@ManyToOne
	@JoinColumn(name="merchant_id")
	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}
	
	@Column(name="express_price")
	public Double getExpressprice() {
		return expressprice;
	}

	public void setExpressprice(Double expressprice) {
		this.expressprice = expressprice;
	}
	

	@ManyToOne
	@JoinColumn(name="express_id")
	public Express getExpress() {
		return express;
	}

	public void setExpress(Express express) {
		this.express = express;
	}
	@ManyToOne
	@JoinColumn(name="plorder_id")
	public OrderPlat getOrderPlat() {
		return orderPlat;
	}

	public void setOrderPlat(OrderPlat orderPlat) {
		this.orderPlat = orderPlat;
	}

	@ManyToOne
	@JoinColumn(name="corp_id")
	public Corporation getCorp() {
		return corp;
	}

	public void setCorp(Corporation corp) {
		this.corp = corp;
	}

	@OneToMany(mappedBy="order",fetch=FetchType.LAZY)
	@JsonIgnore
	public List<OrderItem> getOrderItemList() {
		return orderItemList;
	}

	public void setOrderItemList(List<OrderItem> orderItemList) {
		this.orderItemList = orderItemList;
	}
	
	@OneToMany(mappedBy="order")
	@JsonIgnore
	public List<VoucherRecord> getVoucherRecordList() {
		return voucherRecordList;
	}

	public void setVoucherRecordList(List<VoucherRecord> voucherRecordList) {
		this.voucherRecordList = voucherRecordList;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="picked_id")
	public Picked getPicked() {
		return picked;
	}

	public void setPicked(Picked picked) {
		this.picked = picked;
	}


	
	
	
}



